<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>04运算符</title>
</head>
<body>

<script>
    //除法显示实际的运算结果
    console.log(3 / 2);
    console.log(4 / 2);

    let a = 1;
    let b = true;
    //松散比较运算符,只比较值
    console.log(a == b);//true转为number也是1,值相同
    //严格比较运算符,先比较类型,在比较值
    console.log(a === b);//number与boolean类型不一样

    console.log(3 > 10);//false直接比数字
    //如果左右两边都死字符,比较的是编码
    //charCodeAT()查看对应字符的编码值
    console.log('3'>'10');//51>49 true
    console.log('3'.charCodeAt())//51
    console.log('10'.charCodeAt())//49
    console.log('奇'>'超');
    console.log('奇'.charCodeAt())
    console.log('超'.charCodeAt())

    //三目运算符 1?2:3
    let c = 0;
    console.log(c == 0 ? 'YES' : 'NO');//'YES'
    //=是赋值符号,给c赋值为0,转为布尔类型是false,所以取到3号位置的值'NO'
    console.log(c = 0 ? 'YES' : 'NO');//'NO'
</script>
</body>
</html>